package com.dong.web.util;

import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;

public class PrintUtil {

	private final String printFormat = "yyyy-MM-dd HH:mm:ss,S";

	public PrintUtil println(Class<?> clazz, String method, Object content) {
		String date = new SimpleDateFormat(printFormat).format(new Date());
		if (content == null) {
			content = "";
		}
		if (content.getClass().isArray()) {
			String arrayString = Arrays.toString((Object[]) content);
			System.out.println(String.format(
					"[%s] DEBUG [%s:%s] - %s(): Loging %s", date,
					clazz.getName(), method, method, arrayString));
		} else {
			System.out.println(String.format(
					"[%s] DEBUG [%s:%s] - %s(): Loging %s", date,
					clazz.getName(), method, method, content));
		}
		return this;
	}

	public String getDate() {
		return new SimpleDateFormat(printFormat).format(new Date());
	}

}
